<!DOCTYPE html>
            
<HTML>
<HEAD>
<meta name="booktitle" content="Developing Applications With Objective Caml" >
 <meta charset="ISO-8859-1"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<META name="GENERATOR" content="hevea 1.05-7 of 2000-02-24">
<META NAME="Author" CONTENT="Christian.Queinnec@lip6.fr">
<LINK rel=stylesheet type="text/css" href="videoc-ocda.css">
<script language="JavaScript" src="videoc.js"><!--
//--></script>
<TITLE>
 Description of the language
</TITLE>
</HEAD>
<BODY class="regularBody">
<A HREF="book-ora002.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora004.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2>Description of the language</H2>

<H5> Objective CAML is a functional language:</H5>
it manipulates functions as values in the language. These can in turn be
passed as arguments to other functions or returned as the result of a
function call.<BR>
<BR>

<H5> Objective CAML is statically typed:</H5>
verification of compatibility between the types of formal and actual
parameters is carried out at program compilation time. From then on it is
not necessary to perform such verification during the execution of the
program, which increases its efficiency. Moreover, verification of typing
permits the elimination of most errors introduced by typos or
thoughtlessness and contributes to execution safety.<BR>
<BR>

<H5> Objective CAML has parametric polymorphism:</H5>
a function which does not traverse the totality of the structure of one of
its arguments accepts that the type of this argument is not fully
determined. In this case this parameter is said to be <EM>polymorphic</EM>. 
This feature permits development of generic code
usable for different data structures, such that the exact representation of
this structure need not be known by the code in question. The typing
algorithm is in a position to make this distinction.<BR>
<BR>

<H5> Objective CAML has type inference:</H5>
the programmer need not give any type information within the program. The
language alone is in charge of deducing from the code the most general type
of the expressions and declarations therein. This <EM>inference</EM> 
is carried out jointly with verification, during program compilation.<BR>
<BR>

<H5> Objective CAML is equipped with an exception mechanism:</H5>
it is possible to interrupt the normal execution of a program in one place
and resume at another place thanks to this facility. This mechanism allows
control of exceptional situations, but it can also be adopted as a
programming style.<BR>
<BR>

<H5> Objective CAML has imperative features:</H5>
I/O, physical modification of values and iterative control structures
are possible without having recourse to functional programming features.
Mixture of the two styles is acceptable, and offers great
development flexibility as well as the possibility of defining new data
structures.<BR>
<BR>

<H5> Objective CAML executes (threads):</H5>
the principal tools for creation, synchronization, management of shared
memory, and interthread communication are predefined.<BR>
<BR>

<H5> Objective CAML communicates on the Internet:</H5>
the support functions needed to open communication channels between different
machines are predefined and permit the development of client-server
applications.<BR>
<BR>

<H5> Numerous libraries are available for Objective CAML:</H5>
classic data structures, I/O, interfacing with system resources, lexical
and syntactic analysis, computation with large numbers, persistent values,
etc.<BR>
<BR>

<H5> A programming environment is available for Objective CAML:</H5>
including interactive toplevel, execution trace, dependency calculation and
profiling.<BR>
<BR>

<H5> Objective CAML interfaces with the C language:</H5>
by calling C functions from an Objective CAML program and vice versa, thus
permitting access to numerous C libraries.<BR>
<BR>

<H5> Three execution modes are available for Objective CAML:</H5>
interactive by means of an interactive toplevel, compilation to bytecodes
interpreted by a virtual machine, compilation to native machine code. The
programmer can thus choose between flexibility of development, portability
of object code between different architectures, or performance on a given
architecture.<BR>
<BR>
<A NAME="toc1"></A>
<H3>Structure of a program</H3>Development of important applications requires the 
programmer or the development team to consider questions of organization
and structure. In Objective CAML, two models are available with distinct
advantages and features.

<H5> The parameterized module model:</H5>
data and procedures are gathered within a single entity with two
facets: the code proper, and its interface. Communication between modules
takes place via their interface. The description of a type may be hidden,
not appearing in the module interface. These abstract data types
facilitate modifications of the internal implementation of a module without
affecting other modules which use it. Moreover, modules can be
parameterized by other modules, thus increasing their reusability.<BR>
<BR>

<H5> The object model:</H5>
descriptions of procedures and data are gathered into entities called <I><FONT COLOR=maroon>classes</FONT></I>; an object is an instance (value) of a class. Interobject
communication is implemented through ``message passing'', the receiving
object determines upon execution (late binding) the procedure corresponding
to the message. In this way, object-oriented programming is
``data-driven''. The program structure comes from the relationships
between classes; in particular inheritance lets one class be defined by
extending another. This model allows concrete, abstract and parameterized
classes. Furthermore, it introduces polymorphism of inclusion by defining
the subtyping relationship between classes.<BR>
<BR>
The choice between these two models allows great flexibility in the logical
organization of an application and facilitates its maintenance and
evolution. There is a duality between these two models. One cannot add
data fields to a module type (no extensibility of data), but one can add
new procedures (extensibility of procedures) acting on data. In the object
model, one can add subclasses of a class (extensibility of data) for
dealing with new cases, but one cannot add new procedures visible from the
ancestor class (no extensibility of procedures). Nevertheless the
combination of the two offers new possibilities for extending data and
procedures.<BR>
<BR>
<A NAME="toc2"></A>
<H3>Safety and efficiency of execution</H3>
Objective CAML bestows excellent execution safety on its programs without
sacrificing their efficiency. Fundamentally, static typing is a
guarantee of the absence of run-time type errors and makes useful static
information available to the compiler without burdening performance with
dynamic type tests. These benefits also extend to the object-oriented
language features. Moreover, the built-in garbage collector adds to the
safety of the language system. Objective CAML's is particularly efficient. The
exception mechanism guarantees that the program will not find itself in an
inconsistent state after a division by zero or an access outside the bounds
of an array. <BR>
<BR>
<HR>
<A HREF="book-ora002.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora004.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
